package controller;

import help.Pagination;
import java.util.ArrayList;

public class AppController {
   
    ArrayList<Pagination> pagination = new ArrayList();
    int page_size = 10;
    int page_number = 1;
    int total = 0;

    public int getPage_number() {
        return page_number;
    }

    public void setPage_number(int page_number) {
        this.page_number = page_number;
    }

    public int getPage_size() {
        return page_size;
    }

    public void setPage_size(int page_size) {
        this.page_size = page_size;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public ArrayList<Pagination> getPagination() {
        int t = ((total % page_size) == 0) ? (total / page_size) : (total / page_size + 1);
        for (int x = 1; x < t + 1; x++) {
            if (x == page_number) {
                pagination.add(new Pagination(String.valueOf(x), "true"));
            } else {
                pagination.add(new Pagination(String.valueOf(x), "false"));
            }
        }
        return pagination;
    }

    public void setPagination(ArrayList<Pagination> pagination) {
        this.pagination = pagination;
    }
    
}
